package com.farm.area.dao;

import com.farm.area.pojo.FarmLand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

/**
 * @author azhe
 * @create 2020/10/12
 */
@Repository
public interface FarmLandMapper extends Mapper<FarmLand> {
    @Select("SELECT cf.*,f.name farm_name FROM t_cust_farmland cf, t_cust_farm f where cf.farm_id=f.id")
    List<Map<String,Object>> findAll();

    @Insert("insert into t_cust_farmland_crops values(#{farmlandId}, #{cropsId}, #{startTime}, #{endTime}, #{growStage})")
    int growCrops(Map<String, Object> map);

    @Insert("insert into t_cust_farmland_device values(null,#{farmlandId},#{cdid},#{status},#{position})")
    int installDevice(Map map);
}
